package com.tz.test.util;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author zhangky
 * @since 2020/4/27
 */
public class SingleTon {

    private ExecutorService executorService;

    public static final Integer count = 5;

    private static class CreateExecutor {
        private static SingleTon singleTon = new SingleTon(Executors.newFixedThreadPool(count));
    }

    public static ExecutorService getExecutorService() {
        return CreateExecutor.singleTon.executorService;
    }

    private SingleTon(ExecutorService executorService) {
        this.executorService = executorService;
    }
}
